/**
* 
* ====================================================================
*
* @author apov <apov@ymail.com>
*/ 
#pragma once

#include <BaseDefine.h>
#include <iostream>
#include <vector>
#include <string>
#include <FileObj.h>

class FileExplorer
{
public:
	typedef struct tagFileInfo{
		std::string Fdir;
		std::string Fname;
	}FileInfo;

	//void test_split();
	//virtual void test_print(){};	
	
	void split_file(char* name, size_t byte_size);	

	virtual void distributeFileList(char* Path) = 0;	

	FileExplorer();
	virtual ~FileExplorer();

private:
	typedef std::vector<FileInfo*> FileInfoVector;
	typedef std::vector<std::string> StringVector;	

protected:
	int make_dup_file( FileObj& SrcFileObj, FileObj& DestFileObj, 
					char* dup_file_name, char* buff, 
					size_t byte_size, int nIndex );
	void make_dup_file_name( char* dup_file_name, int& nIndex );

	StringVector m_dirVector;
	FileInfoVector m_fileInfoVector;
};

#ifdef WIN32
class ExplorerWindows : public FileExplorer
{
public:
	//virtual void test_print();
	virtual void distributeFileList(char* Path);

	ExplorerWindows();
	virtual ~ExplorerWindows();
	
public:
	
};

#endif

#ifdef LINUX
class ExplorerLinux : public FileExplorer
{
public:

	//virtual void test_print();
	virtual void distributeFileList(char* Path);

	ExplorerLinux();
	virtual ~ExplorerLinux();	
};

#endif

class FileWorker{
public:	
	void split_file( char* name, size_t byte_size );
	void distributeFileList( char* Path );	

	//void test_split();	
	//void test_print();

	FileWorker();
	virtual ~FileWorker();

protected:

private:
	FileExplorer* worker_;
};
